<?php
/*
 * 前端公共导航
 */
class Navigator 
{
	protected static $_instance = NULL;

	public static function instance ()
	{
		if (NULL === self::$_instance)
		{
			$class = __CLASS__;
			self::$_instance = new $class();
		}

		return self::$_instance;
	}

	public function render()
	{
		$type = site::type();
		$controller = Request::initial()->controller();
		$action     = Request::initial()->action();

		if($controller == 's')
		{
			$alias  = Search_Client::current_alias();
			$action = $alias;
		}

		if ($type == 'member')
		{
			if ($controller == 'shop')
			{
				$content = View::factory('smarty:section/shop/navigator',array(
							'controller'   => $controller,
							'action'       => $action,
						))->render();
			}
			else
			{
				$content = View::factory('smarty:section/navigator',array(
							'controller'   => $controller,
							'action'       => $action,
						))->render();
			}
			return $content;
		}
		else
			return '';
	}
}
